export function isView(dom: HTMLElement) {
    // 获取可视窗口的盖度。
    const screenHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
    // 获取滚动条滚动的高度
    const scrollTop = document.documentElement.scrollTop;
    // 获取元素偏移的高度。就是距离可视窗口的偏移量。
    // console.log(dom.offsetHeight);
    const offsetTop = dom.offsetTop + (dom.offsetHeight / 2);
    console.log(offsetTop, scrollTop);
    return scrollTop - offsetTop > 0;
}
export function isContain(dom: HTMLElement) {
    const totalHeight = window.innerHeight || document.documentElement.clientHeight;
    const totalWidth = window.innerWidth || document.documentElement.clientWidth;
    // 当滚动条滚动时，top, left, bottom, right时刻会发生改变。
    const { top, right, bottom, left } = dom.getBoundingClientRect();
    console.log(top, right, bottom, left)
    return (top >= 0 && left >= 0 && right <= totalWidth && bottom <= totalHeight);
}


export default {}